package demo1;

public class Test {
    private String cpu;
    private String memory;
    private String brand;

    public Test() {
    }

    public Test(String cpu, String memory, String brand) {
        this.cpu = cpu;
        this.memory = memory;
        this.brand = brand;
    }

    public String getCpu() {
        return cpu;
    }

    public void setCpu(String cpu) {
        this.cpu = cpu;
    }

    public String getMemory() {
        return memory;
    }

    public void setMemory(String memory) {
        this.memory = memory;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    @Override
    public String toString() {
        return "Test{" +
                "cpu='" + cpu + '\'' +
                ", memory='" + memory + '\'' +
                ", brand='" + brand + '\'' +
                '}';
    }

    public void TestDemo1(){
        System.out.println("非静态方法");
    }
    public static void TestDemo(){
        System.out.println("静态方法");
        //TestDemo1();//不能直接调用静态方法
        Test t = new Test("i9-14100KF","1TB","Intel");
        t.TestDemo1();//实例化一个对象就可以调用非静态方法了
        //System.out.println("cpu:"cpu);//不能这样
        System.out.println("cpu:"+t.cpu);
    }
}
